package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the FACTORY_ORDER database table.
 * 
 */
@Entity
@Table(name="FACTORY_ORDER")
public class FactoryOrder implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="ORDER_ID")
	private long orderId;

	@Temporal(TemporalType.DATE)
	@Column(name="ORDER_DATE")
	private Date orderDate;

	//bi-directional many-to-one association to CustComplaint
	@OneToMany(mappedBy="factoryOrder")
	private List<CustComplaint> custComplaints;

	//bi-directional many-to-one association to Customer
	@ManyToOne
	@JoinColumn(name="CUSTOMER_ID")
	private Customer customer;

	//bi-directional many-to-one association to OrderLine
	@OneToMany(mappedBy="factoryOrder")
	private List<OrderLine> orderLines;

	public FactoryOrder() {
	}

	public long getOrderId() {
		return this.orderId;
	}

	public void setOrderId(long orderId) {
		this.orderId = orderId;
	}

	public Date getOrderDate() {
		return this.orderDate;
	}

	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}

	public List<CustComplaint> getCustComplaints() {
		return this.custComplaints;
	}

	public void setCustComplaints(List<CustComplaint> custComplaints) {
		this.custComplaints = custComplaints;
	}

	
	public CustComplaint addCustComplaints(CustComplaint custComplaints) {
		getCustComplaints().add(custComplaints);
		custComplaints.setFactoryOrder(this);

		return custComplaints;
	}

	public CustComplaint removeCustComplaints(CustComplaint custComplaints) {
		getCustComplaints().remove(custComplaints);
		custComplaints.setFactoryOrder(null);

		return custComplaints;
	}
	public Customer getCustomer() {
		return this.customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	
	public List<OrderLine> getOrderLines() {
		return this.orderLines;
	}

	public void setOrderLines(List<OrderLine> orderLines) {
		this.orderLines = orderLines;
	}

	
	public OrderLine addOrderLines(OrderLine orderLines) {
		getOrderLines().add(orderLines);
		orderLines.setFactoryOrder(this);

		return orderLines;
	}

	public OrderLine removeOrderLines(OrderLine orderLines) {
		getOrderLines().remove(orderLines);
		orderLines.setFactoryOrder(null);

		return orderLines;
	}
}